<%@page import="com.bms.entity.User"%>
<%@page import="java.util.List"%>
<%@page import="com.bms.dao.UserDao"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<html>
<head>
<title>图书管理信息系统-作者管理</title>
<link rel=stylesheet href="../inc/main.css" type="text/css">
<style type="text/css">
</style>
</head>
<body>
	<!-- 引入head.jsp文件 -->
	<%@include file="/inc/head.jsp"%>
	<table align="center" width="980">
		<tr>
			<td align="right">
				<a href="#" onclick="window.open('<%=request.getContextPath() %>/users/add.jsp','','width=300,height=150')">添加用户</a>
			</td>
		</tr>
	</table>
	<table align="center" width="980" class="head" cellpadding="0" cellspacing="0">
		<caption>用户列表</caption>
		<tr>
			<th width="150">用户ID</th>
			<th width="300">登录帐户</th>
			<th width="300">真实姓名</th>
			<th width="230">操作</th>
		</tr>
		<%
			UserDao dao=new UserDao();
			List<User> users=dao.queryAll();
			if(users!=null){
				for(int i=0;i<users.size();i++){
					User user=users.get(i);					
		%>
		<tr>
			<td align="center"><%=(i+1) %></td>
			<td align="center"><%=user.getUserName() %></td>
			<td align="center"><%=user.getRealName() %></td>
			<td align="center">
				<a href="#" onclick="window.open('<%=request.getContextPath() %>/users/modify.jsp?id=<%=user.getId() %>', '', 'width=300,height=150')">修改</a>  
				<a href="<%=request.getContextPath()%>/userAction?method=delete&id=<%=user.getId()%>">删除</a>
			</td>
		</tr>
		<%
				}
			}else{
		%>
		<tr>
			<td colspan="4" align="center">
				没有用户信息!
			</td>
		</tr>
		<%
			}
		%>
	</table>
</html>